package com.wjjun.library.widget.dropdown;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.ViewDataBinding;

import com.wjjun.base.ui.helper.RecycleViewHelper;
import com.wjjun.base.ui.viewmodel.BaseItemViewModel;
import com.wjjun.base.ui.viewmodel.BaseViewModel;
import com.wjjun.library.R;
import com.wjjun.library.viewmodel.CheckItemViewModel;

import org.jetbrains.annotations.NotNull;

import me.tatarka.bindingcollectionadapter2.ItemBinding;

/**
 * 垂直列表布局
 * item也是使用checkItemViewModel，内部自动使用新的布局
 * author : wangjunjun
 * date   : 2021/10/21
 * desc   :
 */
public class ListMenuTabView extends BaseListMenuTabView {

    public ListMenuTabView(@NonNull Context context) {
        this(context, null);
    }

    public ListMenuTabView(@NonNull Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ListMenuTabView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.common_refresh_list;
    }

    @Override
    protected void initList(ViewDataBinding viewDataBinding) {
        super.initList(viewDataBinding);
    }

    @Override
    public void onItemClick(@NotNull View view, @NotNull BaseViewModel itemViewModel) {
        if (!isShow()) {
            return;
        }
        if (itemViewModel instanceof CheckItemViewModel) {
            onConfirm();
        }
    }

}
